﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace OnlineBookStore
{
    public partial class RegisterWebForm : MyPageBase
    {

        /// <summary>
        /// 当创建用户成功后，将用户添加到user角色中
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
        {
            string[] usernames=new string[1];
            usernames[0]=CreateUserWizard1.UserName;
            Roles.AddUsersToRole(usernames, "users");

        }

        protected void ContinueButton_Click(object sender, EventArgs e)
        {
            string preUrl = Request.QueryString["cururl"];
            if (preUrl != null)
                Response.Redirect(preUrl);
            else
                Response.Redirect("~/Default.aspx");
        }
    }
}
